package 刷题10月.leecodehot100;
// https://leetcode-cn.com/problems/find-the-difference/
public class 数组389找不同1030 {
    class Solution {
        public char findTheDifference(String s, String t) {
            int[] cnt = new int[26];
            for (int i = 0; i < s.length(); ++i) {
                char ch = s.charAt(i);
                cnt[ch - 'a']++;
            }
            for (int i = 0; i < t.length(); ++i) {
                char ch = t.charAt(i);
                cnt[ch - 'a']--;
                if (cnt[ch - 'a'] < 0) {
                    return ch;
                }
            }
            return ' ';
        }
    }

}
